I have installed esm package and application is working fine when using "node -r esm app.js" for local server but for production server How to make it work same with the docker?
If someone could either help me with this loading the esm module it would be appreciated..
Your node installation likely doesn't use globally installed modules. You need to correctly set the NODE_PATH environment variable to point either to the global node modules or those in your app folder, it should work.
Say if you are using the official node docker image as a base and you are installing your stuff with npm install -g or npm install && npm link, then you need to set
ENV NODE_PATH=/usr/local/lib/node_modules
in the dockerfile.